from ext import db
from apps.models import BaseModel


class UserNews(BaseModel):
    __tablename__ = 'user_news'
    username = db.Column(db.String(100), nullable = False, unique = True)
    password = db.Column(db.String(128))
    phone = db.Column(db.String(11), unique = True, nullable = True)
    icon = db.Column(db.String(256))
    newsList = db.relationship('News', backref='author')
    comments = db.relationship('Comment', backref='author')
    replys = db.relationship('Reply', backref='author')

    def __str__(self):
        return self.username